<?php

namespace app\common\model;

use app\common\library\MemberVo;
use app\common\traits\TimeToStringTrait;
use think\Model;

/**
 * 模型
 */
class OrderAftersales extends Model
{
    use TimeToStringTrait;

    // 表名
    protected $name = '';
    protected $deleteTime = false;
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';

    // 追加属性
    protected $append = [

    ];
    const STATUS_WAIT_AUDIT       = 0; // 待审核
    const STATUS_AUDIT_FAIL     = 1; // 审核失败
    const STATUS_PASS   = 2; // 审核通过
    const STATUS_OK = 3; // 退款成功
    const STATUS_FAIL           = 4; // 退款失败


    public function member()
    {
        return $this->belongsTo('member', 'member_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function shop()
    {
        return $this->belongsTo('shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function order()
    {
        return $this->belongsTo('order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function orderAftersalesRecord()
    {
        return $this->hasMany('OrderAftersalesRecord', 'order_aftersales_id');
    }

}
